﻿using System.ComponentModel;
using Util;

namespace IterationLife.ContentResources.Enums
{
    /// <summary>
    /// 内容资源状态
    /// </summary>
    public enum ContentResourceState
    {
        /// <summary>
        /// 草稿
        /// </summary>
        [Description("草稿")]
        Draft = 1,
        /// <summary>
        /// 发表
        /// </summary>
        [Description("发表")]
        Publish=2
    }

    /// <summary>
    /// 内容资源状态枚举扩展
    /// </summary>
    public static class ContentResourceStateExtensions
    {
        /// <summary>
        /// 获取描述
        /// </summary>
        public static string Description(this ContentResourceState? type)
        {
            return type == null ? string.Empty : type.Value.Description();
        }

        /// <summary>
        /// 获取值
        /// </summary>
        public static int? Value(this ContentResourceState? type)
        {
            return type?.Value();
        }
    }

}
